package com.supreme.simpleserver.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 定义Aspect切面拦截service
 */
@Aspect
//@Component
@Slf4j
public class ServiceAspect {

    private static final String AOP_POINTCUT_EXPRESSION = "execution(public * com.supreme.simpleserver.service..*.*(..))";

    @Pointcut(value = AOP_POINTCUT_EXPRESSION)
    public void PointCut() {
    }

    /**
     * 自定义事务
     * @param proceedingJoinPoint
     * @return
     */
    @Around(value = "PointCut()")
    public Object aroundMethod(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        log.info("==========> 目标方法");
        Object object = proceedingJoinPoint.proceed();;
        return object;
    }
}
